package com.venue.hjt.venueclass.utlis;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.venue.hjt.venueclass.BaseApplication;
import com.venue.hjt.venueclass.R;
import com.venue.hjt.venueclass.adapter.VenueOrderAdapter;
import com.venue.hjt.venueclass.adapter.VenueOrderAdapter1;
import com.venue.hjt.venueclass.adapter.VenuePAdapter;
import com.venue.hjt.venueclass.bean.API;
import com.venue.hjt.venueclass.bean.ContactSortModel;
import com.venue.hjt.venueclass.bean.GroupBean;
import com.venue.hjt.venueclass.bean.VenueBean;
import com.venue.hjt.venueclass.db.CardDao;
import com.venue.hjt.venueclass.db.Cardnumber;
import com.venue.hjt.venueclass.db.VenueBooKing;
import com.venue.hjt.venueclass.db.VenueEvaluate;
import com.venue.hjt.venueclass.db.VenueInfo;
import com.venue.hjt.venueclass.ui.VenueComplaintActivity;
import com.venue.hjt.venueclass.ui.VenueOrderActivity;
import com.venue.hjt.venueclass.view.CircleImageView;
import com.venue.hjt.venueclass.view.MyDialog;
import com.venue.hjt.venueclass.view.MyGridView;
import com.venue.hjt.venueclass.view.StarBar;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import okhttp3.Call;


/**
 *
 */

public class DialogUtlis {
    TextView tv_dialog_countdown1;
    MyDialog builder;
    MyDialog builders;
    int j=10;
    int j1=20;
    public  void showDialog(final Context context, final int i, String str, final String tid,
                            final String groupname, final String time, final String sign,
                            final String sign_num, final String booker, final String user, final String me,
                            final int typeuser, final int typemanager){
       LayoutInflater inflater=LayoutInflater.from(context);
       View view=inflater.inflate(R.layout.dialog_crad,null);
       final EditText tv_Dialog_card=view.findViewById(R.id.tv_Dialog_card);
        TextView tv_venue_name=view.findViewById(R.id.tv_venue_name);
        tv_dialog_countdown1=view.findViewById(R.id.tv_dialog_countdown1);
       tv_Dialog_card.requestFocus();

        tv_venue_name.setText(str);
        builder = new MyDialog(context,0,0,view,R.style.dialog);
       builder.getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
               WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        builder.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
       builder.setCancelable(false);
       builder.show();
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (; j >0; j--) {
                    handler.sendEmptyMessage(1);
                    if(j<=0){
                        break;
                    }
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                handler.sendEmptyMessage(2);
            }
        }).start();
        tv_Dialog_card.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                String strCardNo=tv_Dialog_card.getText().toString().trim();
                List<Cardnumber> cardnumbers = CardDao.queryLove(strCardNo);
                Log.e("ATG",strCardNo);
                if (cardnumbers.size()!=0){
                    if (cardnumbers.get(0).getType()==1){
                        if (i==0){
                            Intent intent=new Intent(context, VenueOrderActivity.class);
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            intent.putExtra("student_no",cardnumbers.get(0).getCardStudent().getId());
                            context.startActivity(intent);
                            j=1;
                        }else if (i==1){
                            Intent intent=new Intent(context, VenueComplaintActivity.class);
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            intent.putExtra("card_no",cardnumbers.get(0).getCardStudent().getCard_no());
                            context.startActivity(intent);
                            j=1;
                        }else if (i==3){
                            String id = cardnumbers.get(0).getCardStudent().getId();
                            if (id.equals(booker)){
                                if (user.equals("0")&&typeuser==0){
                                    List<VenueEvaluate> venueEvaluates = CardDao.queryVenueEvaluateType("1");
                                    showP1Dialog(context,venueEvaluates,tid);
                                    builder.dismiss();
                                }else{
                                    Toast.makeText(context,"已经评价过",Toast.LENGTH_LONG).show();
                                    builder.dismiss();
                                }

                            }else{
                                Toast.makeText(context,"只有预约人和管理员能评价",Toast.LENGTH_LONG).show();
                                builder.dismiss();
                            }
                        }
                    }else if(cardnumbers.get(0).getType()==2){
                        if (i==1){
                            Intent intent=new Intent(context,VenueComplaintActivity.class);
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            intent.putExtra("card_no",cardnumbers.get(0).getCardStudent().getCard_no());
                            context.startActivity(intent);
                            j=1;
                        }else if (i==3){
                            if (me.equals("0")&&typemanager==0){
                                List<VenueEvaluate> venueEvaluates1 = CardDao.queryVenueEvaluateType("0");
//                        应到23人/已到17人/未到6人
                                showPDialog(context, venueEvaluates1,tid,groupname,"("+time+"场馆使用)",sign,sign_num);
                                builder.dismiss();
                            }else{
                                Toast.makeText(context,"已经评价过",Toast.LENGTH_LONG).show();
                                builder.dismiss();
                            }

                        }

                    }
                }

                tv_Dialog_card.setText("");
                return false;
            }
        });

   }
    Handler handler = new Handler() {
        public void handleMessage(android.os.Message msg) {
            if (msg.what == 1) {
                tv_dialog_countdown1.setText("还剩" + j + "关闭界面");
            } else {
                builder.dismiss();
                j=10;
            }
        }
    };
    Handler handler1 = new Handler() {
        public void handleMessage(android.os.Message msg) {
            if (msg.what == 1) {
                tv_dialog_countdown1.setText("还剩" + j1 + "关闭界面");
            } else {
                builders.dismiss();
                j1=20;
            }
        }
    };
    public void dismiss(){
        j=1;
    }
    public  void showYDialog(final Context context, final String venue_id, final String group_id, final String VenueOrderTime,
                             final String tv_y_time, final String tv_y_time01, final String str, String dia_name, String dia_x, String dia_g, String dia_t,
                             final String student_no,final String text){
        j=15;
        LayoutInflater inflater=LayoutInflater.from(context);
        View view=inflater.inflate(R.layout.main2,null);
        Button bt_q=view.findViewById(R.id.bt_q);
        Button bt_w=view.findViewById(R.id.bt_w);
        TextView tv_dia_name=view.findViewById(R.id.tv_dia_name);
        tv_dialog_countdown1=view.findViewById(R.id.tv_dialog_countdown1);
        TextView tv_dia_x=view.findViewById(R.id.tv_dia_x);
        TextView tv_dia_time=view.findViewById(R.id.tv_dia_time);
        TextView tv_score=view.findViewById(R.id.tv_score);
        TextView tv_dia_g=view.findViewById(R.id.tv_dia_g);
        TextView tv_dia_t=view.findViewById(R.id.tv_dia_t);

        tv_dia_name.setText(dia_name);
        tv_dia_x.setText(dia_x);
        tv_dia_g.setText(dia_g);
        tv_dia_t.setText(dia_t);
        List<VenueInfo> venueInfos = CardDao.queryVenueInfo();
        if (venueInfos.size()!=0){
            tv_score.setText("消耗 "+venueInfos.get(0).getScore()+"积分");
        }
        tv_dia_time.setText(VenueOrderTime+" "+tv_y_time+"～"+tv_y_time01);
        builder = new MyDialog(context,0,0,view,R.style.dialog);
        builder.getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
                WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        builder.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        builder.show();
        builder.setCancelable(false);
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (; j >0; j--) {
                    handler.sendEmptyMessage(1);
                    if(j<=0){
                        break;
                    }
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                handler.sendEmptyMessage(2);
            }
        }).start();
        bt_q.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                j=1;
            }
        });

        bt_w.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (tv_y_time.equals("")||tv_y_time01.equals("")){
                    Toast.makeText(context,"请选择当前预约时间",Toast.LENGTH_LONG).show();
                    return;
                }
                Log.e("ATG ",API.VENUEbooking + Constant.SNO + "&venue_id=" + venue_id + "&booker=" +student_no+ "&group_id=" + group_id + "&start_time=" + VenueOrderTime + tv_y_time + "&end_time=" + VenueOrderTime + tv_y_time01 + str.toString()+"&remark="+text);
                OkhttPost.Okget(API.VENUEbooking + Constant.SNO + "&venue_id=" + venue_id + "&booker=" +student_no+ "&group_id=" + group_id + "&start_time=" + VenueOrderTime + tv_y_time + "&end_time=" + VenueOrderTime + tv_y_time01 + str.toString()+"&remark="+text, 1, new OkhttPost.Callback() {
                    @Override
                    public void onError(Call call, Exception e, int id) {
                        Log.e("ATG",e.toString());
                    }
                    @Override
                    public void onResponse(String response, int id) {
                        Log.e("ATG",response+"  预约");
                        Gson gson=new Gson();
                        VenueBean bean = gson.fromJson(response, VenueBean.class);
                        if (bean.code==1){
                            Intent intent=new Intent();
                            intent.setAction(Constant.ORDER);
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            context.sendBroadcast(intent);
                            Toast.makeText(context,bean.msg,Toast.LENGTH_LONG).show();
                        }else{
                            Toast.makeText(context,bean.msg,Toast.LENGTH_LONG).show();
                        }
                        builder.dismiss();
                    }
//                    http://129.1.2.243/hjtgrow/public/boardApi/venue/booking?sno=98&venue_id=1&booker=6141&group_id=8&start_time=2018-03-15%2011:00&end_time=2018-03-15%2012:00&members[]=1457&members[]=1457&members[]=5806
            });
            }
        });
    }

    public static void showStudentDialog(final Context contxt,String url) {
        final Dialog dialog= new Dialog(contxt, R.style.ActionSheetDialogStyle);
        dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
        dialog.setCanceledOnTouchOutside(true);
        dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        //填充对话框的布
        View inflate = LayoutInflater.from(contxt).inflate(R.layout.dialog_studentqd, null);
        TextView tv_time=  inflate.findViewById(R.id.tv_time);
        TextView tv_Sign=  inflate.findViewById(R.id.tv_Sign);
        CircleImageView civ_icon=  inflate.findViewById(R.id.civ_icon);
//        if (!cardStudent.getStudent_url().equals("无头像")) {
//            Glide.with(contxt).load(cardStudent.getStudent_url()).error(R.mipmap.student).into(civ_icon);
//        }
//        TextView tv_studentName= (TextView) inflate.findViewById(R.id.tv_studentName);
        tv_Sign.setText("签到成功");
        tv_time.setText("刷卡时间 "+ ClassCalendar.getIntTimes());
        if (!url.equals("")){
            Glide.with(contxt).load(url).error(R.mipmap.student).into(civ_icon);
        }else{
            civ_icon.setImageResource(R.mipmap.student);
        }
        dialog.setContentView(inflate);

        dialog.show();//显示对话框
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                dialog.dismiss();
            }
        },2000);
    }
    public  void showPDialog(final Context context, final List<VenueEvaluate> list, final String id,String sign_name,String sign_time,String sign,String sign_num){
        j1=20;
        LayoutInflater inflater=LayoutInflater.from(context);
        View view=inflater.inflate(R.layout.main1,null);
        ListView lv_p=view.findViewById(R.id.lv_p);
        Button bt_sign_q=view.findViewById(R.id.bt_sign_q);
        TextView tv_sign_name=view.findViewById(R.id.tv_sign_name);
        TextView tv_sign_time=view.findViewById(R.id.tv_sign_time);
        TextView tv_sign=view.findViewById(R.id.tv_sign);
        TextView tv_sign_num=view.findViewById(R.id.tv_sign_num);
        tv_dialog_countdown1=view.findViewById(R.id.tv_dialog_countdown1);
//        List<VenueEvaluate> list=new ArrayList<>();
        VenuePAdapter adapter=new VenuePAdapter(context,list);
        lv_p.setAdapter(adapter);
        tv_sign_name.setText(sign_name);
        tv_sign_time.setText(sign_time);
        tv_sign_num.setText(sign_num);
        tv_sign.setText(sign);
        builders = new MyDialog(context,0,0,view,R.style.dialog);
        builders.getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
                WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        builders.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        builders.show();
        builders.setCancelable(false);
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (; j1 >0; j1--) {
                    Log.e("ATG","jj "+j1);
//                    tv_dialog_countdown1.setText("还剩" + j1 + "关闭界面");
                    handler1.sendEmptyMessage(1);
                    if(j1<=0){
                        break;
                    }
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                handler1.sendEmptyMessage(2);
            }
        }).start();
        bt_sign_q.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                boardApi/venue/booking/comment?sno=98&booking_id=11&c_type=manager&comments=干净利落:3,安静:4&total=2
                StringBuilder builder1=new StringBuilder();
                List<VenueEvaluate> venueEvaluates = CardDao.queryVenueEvaluateType("1");
                for (int i=0;i<venueEvaluates.size();i++){
                    if (i==venueEvaluates.size()-1){
                        switch (Integer.parseInt(venueEvaluates.get(i).getScore())){
                            case 1:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar1()+":");
                                builder1.append( venueEvaluates.get(i).getScore());
                                break;
                            case 2:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar2()+":");
                                builder1.append( venueEvaluates.get(i).getScore());
                                break;
                            case 3:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar3()+":");
                                builder1.append( venueEvaluates.get(i).getScore());
                                break;
                            case 4:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar4()+":");
                                builder1.append( venueEvaluates.get(i).getScore());
                                break;
                            case 5:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar5()+":");
                                builder1.append( venueEvaluates.get(i).getScore());
                                break;
                        }

                    }else{
                        switch (Integer.parseInt(venueEvaluates.get(i).getScore())){
                            case 1:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar1()+":");
                                builder1.append( venueEvaluates.get(i).getScore()+",");
                                break;
                            case 2:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar2()+":");
                                builder1.append( venueEvaluates.get(i).getScore()+",");
                                break;
                            case 3:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar3()+":");
                                builder1.append( venueEvaluates.get(i).getScore()+",");
                                break;
                            case 4:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar4()+":");
                                builder1.append( venueEvaluates.get(i).getScore()+",'");
                                break;
                            case 5:
                                builder1.append( venueEvaluates.get(i).getTitle()+":");
                                builder1.append( venueEvaluates.get(i).getStar5()+":");
                                builder1.append( venueEvaluates.get(i).getScore()+",");
                                break;
                        }
                    }

                }
                Log.e("ATG",API.VENUECOMMENT + Constant.SNO + "&booking_id=" +id+ "&c_type=manager" + "&comments="+builder1.toString());
                final List<VenueBooKing> venueBooKings = CardDao.queryVenueBooKingId(id);
                OkhttPost.Okget(API.VENUECOMMENT + Constant.SNO + "&booking_id=" +id+ "&c_type=manager" + "&comments="+builder1.toString(), 1, new OkhttPost.Callback() {
                    @Override
                    public void onError(Call call, Exception e, int id) {

                    }

                    @Override
                    public void onResponse(String response, int id) {
                        Log.e("ATG",response);
                        Gson gson=new Gson();
                        VenueBean bean = gson.fromJson(response, VenueBean.class);
                        if (bean.code==1){
                            if (venueBooKings.size()!=0){
                                venueBooKings.get(0).setTypemanager(1);
                                BaseApplication.getDaoInstant().getVenueBooKingDao().update(venueBooKings.get(0));
                                BaseApplication.getDaoInstant().clear();
                            }
                        }
                        Toast.makeText(context,bean.msg,Toast.LENGTH_LONG).show();
                        builders.dismiss();
                    }
                });
            }
        });
    }
    public  void showP1Dialog(final Context context, final List<VenueEvaluate> list, final String id){
        j1=20;
        LayoutInflater inflater=LayoutInflater.from(context);
        View view=inflater.inflate(R.layout.dialog_p,null);
        ListView lv_p=view.findViewById(R.id.lv_p);
        Button bt_sign_q=view.findViewById(R.id.bt_sign_q);
        tv_dialog_countdown1=view.findViewById(R.id.tv_dialog_countdown1);
//        List<VenueEvaluate> list=new ArrayList<>();
        VenuePAdapter adapter=new VenuePAdapter(context,list);
        lv_p.setAdapter(adapter);

       builders = new MyDialog(context,0,0,view,R.style.dialog);
        builders.getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
                WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
//        builders.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        builders.show();
        builders.setCancelable(false);
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (; j1 >0; j1--) {
                    handler1.sendEmptyMessage(1);
                    if(j1<=0){
                        break;
                    }
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                handler1.sendEmptyMessage(2);
            }
        }).start();
        bt_sign_q.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                boardApi/venue/booking/comment?sno=98&booking_id=11&c_type=manager&comments=干净利落:3,安静:4&total=2
                StringBuilder builder1=new StringBuilder();
                for (int i=0;i<list.size();i++){
//                    if (i==list.size()-1){
//                        builder1.append( list.get(i).getTitle()+":");
//                        builder1.append( list.get(i).getScore());
//                    }else{
//                        builder1.append( list.get(i).getTitle()+":");
//                        builder1.append( list.get(i).getScore()+",");
//                    }
                    if (i==list.size()-1){
                        switch (Integer.parseInt(list.get(i).getScore())){
                            case 1:
                                Log.e("ATG","1");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar1()+":");
                                builder1.append( list.get(i).getScore());
                                break;
                            case 2:
                                Log.e("ATG","2");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar2()+":");
                                builder1.append( list.get(i).getScore());
                                break;
                            case 3:
                                Log.e("ATG","3");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar3()+":");
                                builder1.append( list.get(i).getScore());
                                break;
                            case 4:
                                Log.e("ATG","4");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar4()+":");
                                builder1.append( list.get(i).getScore());
                                break;
                            case 5:
                                Log.e("ATG","5");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar5()+":");
                                builder1.append( list.get(i).getScore());
                                break;
                        }

                    }else{
                        switch (Integer.parseInt(list.get(i).getScore())){
                            case 1:
                                Log.e("ATG","s1");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar1()+":");
                                builder1.append( list.get(i).getScore()+",");
                                break;
                            case 2:
                                Log.e("ATG","s2");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar2()+":");
                                builder1.append( list.get(i).getScore()+",");
                                break;
                            case 3:
                                Log.e("ATG","s3");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar3()+":");
                                builder1.append( list.get(i).getScore()+",");
                                break;
                            case 4:
                                Log.e("ATG","s4");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar4()+":");
                                builder1.append( list.get(i).getScore()+",'");
                                break;
                            case 5:
                                Log.e("ATG","s5");
                                builder1.append( list.get(i).getTitle()+":");
                                builder1.append( list.get(i).getStar5()+":");
                                builder1.append( list.get(i).getScore()+",");
                                break;
                        }
                    }
                }
                final List<VenueBooKing> venueBooKings = CardDao.queryVenueBooKingId(id);
                Log.e("ATG",API.VENUECOMMENT + Constant.SNO + "&booking_id=" +id+ "&c_type=applyer" + "&comments="+builder1.toString());
                OkhttPost.Okget(API.VENUECOMMENT + Constant.SNO + "&booking_id=" +id+ "&c_type=applyer" + "&comments="+builder1.toString(), 1, new OkhttPost.Callback() {
                    @Override
                    public void onError(Call call, Exception e, int id) {

                    }

                    @Override
                    public void onResponse(String response, int id) {
                        Log.e("ATG",response);
                        Gson gson=new Gson();
                        VenueBean bean = gson.fromJson(response, VenueBean.class);
                        if (bean.code==1){
                            if (venueBooKings.size()!=0){
                                venueBooKings.get(0).setTypeuser(1);
                                BaseApplication.getDaoInstant().getVenueBooKingDao().update(venueBooKings.get(0));
                                BaseApplication.getDaoInstant().clear();
                            }
                        }
                        Toast.makeText(context,bean.msg,Toast.LENGTH_LONG).show();
                        builders.dismiss();
                    }
                });
            }
        });
    }
}
